/* Raw data processing: Label countyid with county name
change variable names shorter
add a variable shaleregion by collapse categories of wells */

clear all
insheet using "D:\shale_job\numbered_tx_county_emp_wells.csv", comma

ren weekly_wage wage
ren employment emp

replace wells = 0 if wells >=.
replace oil = 0 if oil >=.
replace gas = 0 if gas >=.
replace others = 0 if others >=.

label define countylabel 1 "Anderson"	2 "Andrews"	3 "Angelina"	4 "Aransas"	5 "Archer"	6 "Armstrong"	7 "Atascosa"	8 "Austin"	9 "Bailey"	10 "Bandera"	11 "Bastrop"	12 "Baylor"	13 "Bee"	14 "Bell"	15 "Bexar"	16 "Blanco"	17 "Borden"	18 "Bosque"	19 "Bowie"	20 "Brazoria"	21 "Brazos"	22 "Brewster"	23 "Briscoe"	24 "Brooks"	25 "Brown"	26 "Burleson"	27 "Burnet"	28 "Caldwell"	29 "Calhoun"	30 "Callahan"	31 "Cameron"	32 "Camp"	33 "Carson"	34 "Cass"	35 "Castro"	36 "Chambers"	37 "Cherokee"	38 "Childress"	39 "Clay"	40 "Cochran"	41 "Coke"	42 "Coleman"	43 "Collin"	44 "Collingsworth"	45 "Colorado"	46 "Comal"	47 "Comanche"	48 "Concho"	49 "Cooke"	50 "Coryell"	51 "Cottle"	52 "Crane"	53 "Crockett"	54 "Crosby"	55 "Culberson"	56 "Dallam"	57 "Dallas"	58 "Dawson"	59 "DeWitt"	60 "Deaf Smith"	61 "Delta"	62 "Denton"	63 "Dickens"	64 "Dimmit"	65 "Donley"	66 "Duval"	67 "Eastland"	68 "Ector"	69 "Edwards"	70 "El Paso"	71 "Ellis"	72 "Erath"	73 "Falls"	74 "Fannin"	75 "Fayette"	76 "Fisher"	77 "Floyd"	78 "Foard"	79 "Fort Bend"	80 "Franklin"	81 "Freestone"	82 "Frio"	83 "Gaines"	84 "Galveston"	85 "Garza"	86 "Gillespie"	87 "Glasscock"	88 "Goliad"	89 "Gonzales"	90 "Gray"	91 "Grayson"	92 "Gregg"	93 "Grimes"	94 "Guadalupe"	95 "Hale"	96 "Hall"	97 "Hamilton"	98 "Hansford"	99 "Hardeman"	100 "Hardin"	101 "Harris"	102 "Harrison"	103 "Hartley"	104 "Haskell"	105 "Hays"	106 "Hemphill"	107 "Henderson"	108 "Hidalgo"	109 "Hill"	110 "Hockley"	111 "Hood"	112 "Hopkins"	113 "Houston"	114 "Howard"	115 "Hudspeth"	116 "Hunt"	117 "Hutchinson"	118 "Irion"	119 "Jack"	120 "Jackson"	121 "Jasper"	122 "Jeff Davis"	123 "Jefferson"	124 "Jim Hogg"	125 "Jim Wells"	126 "Johnson"	127 "Jones"	128 "Karnes"	129 "Kaufman"	130 "Kendall"	131 "Kenedy"	132 "Kent"	133 "Kerr"	134 "Kimble"	135 "King"	136 "Kinney"	137 "Kleberg"	138 "Knox"	139 "La Salle"	140 "Lamar"	141 "Lamb"	142 "Lampasas"	143 "Lavaca"	144 "Lee"	145 "Leon"	146 "Liberty"	147 "Limestone"	148 "Lipscomb"	149 "Live Oak"	150 "Llano"	151 "Loving"	152 "Lubbock"	153 "Lynn"	154 "Madison"	155 "Marion"	156 "Martin"	157 "Mason"	158 "Matagorda"	159 "Maverick"	160 "McCulloch"	161 "McLennan"	162 "McMullen"	163 "Medina"	164 "Menard"	165 "Midland"	166 "Milam"	167 "Mills"	168 "Mitchell"	169 "Montague"	170 "Montgomery"	171 "Moore"	172 "Morris"	173 "Motley"	174 "Nacogdoches"	175 "Navarro"	176 "Newton"	177 "Nolan"	178 "Nueces"	179 "Ochiltree"	180 "Oldham"	181 "Orange"	182 "Palo Pinto"	183 "Panola"	184 "Parker"	185 "Parmer"	186 "Pecos"	187 "Polk"	188 "Potter"	189 "Presidio"	190 "Rains"	191 "Randall"	192 "Reagan"	193 "Real"	194 "Red River"	195 "Reeves"	196 "Refugio"	197 "Roberts"	198 "Robertson"	199 "Rockwall"	200 "Runnels"	201 "Rusk"	202 "Sabine"	203 "San Augustine"	204 "San Jacinto"	205 "San Patricio"	206 "San Saba"	207 "Schleicher"	208 "Scurry"	209 "Shackelford"	210 "Shelby"	211 "Sherman"	212 "Smith"	213 "Somervell"	214 "Starr"	215 "Stephens"	216 "Sterling"	217 "Stonewall"	218 "Sutton"	219 "Swisher"	220 "Tarrant"	221 "Taylor"	222 "Terrell"	223 "Terry"	224 "Throckmorton"	225 "Titus"	226 "Tom Green"	227 "Travis"	228 "Trinity"	229 "Tyler"	230 "Upshur"	231 "Upton"	232 "Uvalde"	233 "Val Verde"	234 "Van Zandt"	235 "Victoria"	236 "Walker"	237 "Waller"	238 "Ward"	239 "Washington"	240 "Webb"	241 "Wharton"	242 "Wheeler"	243 "Wichita"	244 "Wilbarger"	245 "Willacy"	246 "Williamson"	247 "Wilson"	248 "Winkler"	249 "Wise"	250 "Wood"	251 "Yoakum"	252 "Young"	253 "Zapata"	254 "Zavala", modify

label val countycode countylabel
drop county
ren countycode county

drop shaleregion
recode wells (0/4=0) (5/50=1) (50/1016=2), gen (shaleRegion)


save "D:\shale_job\tx_county_emp_wells.dta", replace
